#include <QtPlugin>

#include <QVBoxLayout>
#include <QSpinBox>
#include <QLabel>
#include <QWidget>
#include <QPushButton>

#include <opencv/cv.h>
#include <opencv/highgui.h>

#include <iostream>

#include "CLUT.h"
#include "QCVModuleInterface.h"
#include "QCVModuleHandlerInterface.h"

#ifndef MODULE_CLUT_EXPLORER
#define MODULE_CLUT_EXPLORER

class ModuleSlice:public QObject,QCVModuleInterface
{
  Q_OBJECT
	Q_INTERFACES(QCVModuleInterface)
	
	public:
		void init(QCVModuleHandlerInterface * parent);
		void free();

		cv::Mat & process();
		void setInput(int n,const cv::Mat & m);

		QWidget* widget();
		QString getName();
		int nbInputs();
		QString help(int id);
		bool setParams(QString params);
    QString getParams();

		QCVModuleInterface * clone();
	
	private slots:
		void s_chromaChanged(int);
		void s_send();
		void s_resChanged(int);

	private:  

		//retourne une tranche Saturation brillance corres
		void getChromaSlice(unsigned char T,cv::Mat & slice);
		float HUE_2_RGB(float v1,float v2,float H);
			
		QWidget * win;
    QVBoxLayout * layout;
		QSpinBox * sb_getChroma,*sb_res;
		QPushButton * pb_send;
		
		cv::Mat slice;

		QCVModuleHandlerInterface * parent;
};

#endif
